-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(explore-suspect-attrs): Iterating on series data, sorting or dat… #95401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…g or data and tooltip" This reverts commit fa0ccaf.
const cohort1Map = new Map(cohort1.map(({label, value}) => [label, value])); | ||
const cohort2Map = new Map(cohort2.map(({label, value}) => [label, value])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, is there a reason you used a map here instead of an object? It looks like your just using cohort1Map
as a simple key value mapping and not taking advantage of the benefits of a map (like that it's iterable and ordered)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a residue from me initially thinking that we will need 'iterability', I'll use a record in a cleanup PR, soon
The functionality in this PR is under the flag `performance-spans-suspect-attributes`: - Virtualizes the list of charts - Adds search - Fixes tooltip (we couldn't append tooltip to `document.body` without virtualization. It's too expensive, when we have hundreds of charts, otherwise). <img width="848" height="805" alt="Screenshot 2025-07-14 at 1 14 35 AM" src="https://github.com/user-attachments/assets/74946b5e-c946-42bf-84c9-4bc406d700fe" /> --------- Co-authored-by: Abdullah Khan <abdullahkhan@PG9Y57YDXQ.local>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Chart Tooltips Show NaN% Due to Undefined Data
The valueFormatter
function in Chart
can cause "NaN%" to be displayed in tooltips. This occurs because the optional label
parameter is used directly to access seriesTotals
, potentially resulting in undefined
and subsequent NaN
in percentage calculations. Additionally, Number(seriesParams?.data)
can convert an undefined
data
value to NaN
, further contributing to incorrect percentages.
static/app/views/explore/components/suspectTags/charts.tsx#L153-L167
sentry/static/app/views/explore/components/suspectTags/charts.tsx
Lines 153 to 167 in e08732c
const valueFormatter = useCallback( | |
(_value: number, label?: string, seriesParams?: CallbackDataParams) => { | |
const data = Number(seriesParams?.data); | |
const total = seriesTotals[label as keyof typeof seriesTotals]; | |
if (total === 0) { | |
return '\u2014'; | |
} | |
const percentage = (data / total) * 100; | |
return `${percentage.toFixed(1)}%`; | |
}, | |
[seriesTotals] | |
); |
Was this report helpful? Give feedback by reacting with 👍 or 👎
…a and tooltip
cohortsToSeriesData
takes the cohorts and assigns a value of '0' to the chart series data if a label is not present in a cohort. Example:cohort1: {'prod': 1, 'local': 2}
andcohort2: {'local': 3}
----->series_cohort_1: [{label: 'prod', value: '1'},{label: 'local', value: '2'}]
andseries_cohort_2: [{label: 'prod', value: '0'},{label: 'local', value: '3'}]
Note: Removed confining of tooltip, it will be cut off at the boundaries. Will set appendToBody:true (which pushes the tooltip up to document.body) along with the virtualization PR, otherwise the screen freezes trying to do it for too many charts.